﻿using System;
using System.Data;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using JTLeigh.Commerce.Spencer.Features.ProductFeedback.Common.Entities;
using JTLeigh.Commerce.Spencer.Features.ProductFeedback.Data.Providers;
using JTLeigh.Commerce.Spencer.Core.Testing;
using JTLeigh.Commerce.Spencer.Core.Data;
using JTLeigh.Commerce.Spencer.Core.Testing.Mocks.Data;

namespace JTLeigh.Commerce.Spencer.Features.ProductFeedback.Data.UnitTests.Providers
{

	/// <summary>
	/// Unit tests for the <see cref="ProductFeedbackMetadataProvider"/> class.
	/// </summary>
	[TestClass]
	public class ProductFeedbackMetadataProviderFixture
	{

		#region Inner Classes and Types

		private static class Constants
		{

            public static class ProductFeedbackBadge
            {

                public static class BadgeId
                {
	                public static readonly Guid Featured = new Guid("B8263404-C853-423C-9E7B-AADCE4431447"); // Featured
	                public static readonly Guid Top1Contributor = new Guid("1D6DB6CD-489F-4981-A542-008AAACD01A3"); // Top 1 Contributor
	                public static readonly Guid Top10Contributor = new Guid("14784C15-F7FC-4A8D-A443-88508F0E9701"); // Top 10 Contributor
                    //public static readonly Guid Top25Contributor = new Guid("B4E2FEA3-664A-4923-8B41-2CB3220DDB86"); // Top 25 Contributor
                    //public static readonly Guid Top50Contributor = new Guid("1C38FAB1-F2B8-449E-AA77-067BF5DE5D5E"); // Top 50 Contributor
                    //public static readonly Guid Top100Contributor = new Guid("545940BA-5A5F-4192-A95C-5DCF9B8A2388"); // Top 100 Contributor
                    //public static readonly Guid Top250Contributor = new Guid("BCF90848-0100-46A9-A3D8-AA6DB49D2184"); // Top 250 Contributor
                    //public static readonly Guid Top500Contributor = new Guid("F1E949E0-8E11-4098-9D67-126F894B9C8E"); // Top 500 Contributor
                    //public static readonly Guid Top1000Contributor = new Guid("7BDBC9E1-F797-4716-8826-7C5B3739C0ED"); // Top 1000 Contributor
                    //public static readonly Guid ProfessionalPhotographer = new Guid("11684C46-C34A-4908-BCD5-DB6584638043"); // Professional Photographer
                    //public static readonly Guid ProfessionalVideographer = new Guid("BBA2BE19-6BD6-4F7A-8233-53EE20306693"); // Professional Videographer
                }

                public static class WellKnownBadgeCode
                {
                    public const byte Featured = 1;
                    public const byte Top1Contributor = 2;
                    public const byte Top10Contributor = 3;
                    //public static readonly byte Top25Contributor = 4;
                    //public static readonly byte Top50Contributor = 5;
                    //public static readonly byte Top100Contributor = 6;
                    //public static readonly byte Top250Contributor = 7;
                    //public static readonly byte Top500Contributor = 8;
                    //public static readonly byte Top1000Contributor = 9;
                    //public static readonly byte ProfessionalPhotographer = 10;
                    //public static readonly byte ProfessionalVideographer = 11;
                }

            }

			// FIXME: Move this.
			public static class ProductRatingAttribute
			{

				public static class AttributeId
				{
					public static readonly Guid ImageQuality = new Guid("21828F07-BFF4-4c96-872A-D7CD055340E4");
					public static readonly Guid SoundQuality = new Guid("3A993AE2-BDB9-4336-B953-ABC19991C2FF");
				}

			}

			// FIXME: Move this.
			public static class ProductRecommendationAttribute
			{

				public static class AttributeId
				{
					public static readonly Guid FamilyMember = new Guid("B004E867-4876-403f-827E-D30852E81D7C");
					public static readonly Guid Friend = new Guid("A36552C6-59AE-4252-89B4-72109A9BF5C3");
				}

			}

			// FIXME: Move this.
			public static class ProductReviewAttribute
			{

				public static class AttributeId
				{
					public static readonly Guid Pros = new Guid("DEFD2F7D-8355-45d1-A4D9-796D9FCDDA11");
					public static readonly Guid Cons = new Guid("042A0ED1-0937-4f1d-94FD-BE342AD5231F");
				}

			}

		}

		private static class StoredProcedure
		{

			public static class GetProductFeedbackMetadata
			{

				public static class Table
				{

                    public static readonly DataTable ProductFeedbackBadge;
                    public static readonly DataTable ProductRatingAttribute;
                    public static readonly DataTable ProductRatingAttributeLocalization;
					public static readonly DataTable ProductRecommendationAttribute;
					public static readonly DataTable ProductRecommendationAttributeLocalization;
					public static readonly DataTable ProductReviewAttribute;
					public static readonly DataTable ProductReviewAttributeLocalization;

					[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "Reviewed.")]
					static Table()
					{
                        ProductFeedbackBadge = new DataTable
                        {
                            Locale = CultureInfo.InvariantCulture
                        };
                        ProductFeedbackBadge.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductFeedbackBadge.BadgeId, typeof(Guid)));
                        ProductFeedbackBadge.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductFeedbackBadge.WellKnownBadgeCode, typeof(byte)));

                        ProductRatingAttribute = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
						ProductRatingAttribute.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductRatingAttribute.AttributeId, typeof(Guid)));
						ProductRatingAttribute.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductRatingAttribute.DefaultText, typeof(string)));

						ProductRatingAttributeLocalization = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
						ProductRatingAttributeLocalization.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductRatingAttribute.AttributeId, typeof(Guid)));
						ProductRatingAttributeLocalization.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductRatingAttributeLocalization.CultureId, typeof(int)));
						ProductRatingAttributeLocalization.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductRatingAttributeLocalization.Text, typeof(string)));

						ProductRecommendationAttribute = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
						ProductRecommendationAttribute.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductRecommendationAttribute.AttributeId, typeof(Guid)));
						ProductRecommendationAttribute.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductRecommendationAttribute.DefaultText, typeof(string)));

						ProductRecommendationAttributeLocalization = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
						ProductRecommendationAttributeLocalization.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductRecommendationAttribute.AttributeId, typeof(Guid)));
						ProductRecommendationAttributeLocalization.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductRecommendationAttributeLocalization.CultureId, typeof(int)));
						ProductRecommendationAttributeLocalization.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductRecommendationAttributeLocalization.Text, typeof(string)));

						ProductReviewAttribute = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
						ProductReviewAttribute.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductReviewAttribute.AttributeId, typeof(Guid)));
						ProductReviewAttribute.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductReviewAttribute.DefaultText, typeof(string)));

						ProductReviewAttributeLocalization = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
						ProductReviewAttributeLocalization.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductReviewAttribute.AttributeId, typeof(Guid)));
						ProductReviewAttributeLocalization.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductReviewAttributeLocalization.CultureId, typeof(int)));
						ProductReviewAttributeLocalization.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.ColumnName.ProductReviewAttributeLocalization.Text, typeof(string)));
					}

				}

			}

            public static class GetProductFeedbackBadgeProductRelations
            {

                public static class Table
                {

                    public static readonly DataTable ProductFeedbackBadgeProductAssociation;
                    public static readonly DataTable ProductFeedbackBadgeProductDisassociation;

                    [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "Reviewed.")]
                    static Table()
                    {
                        ProductFeedbackBadgeProductAssociation = new DataTable
                        {
                            Locale = CultureInfo.InvariantCulture
                        };
                        ProductFeedbackBadgeProductAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackBadgeProductRelations.ColumnNames.ProductFeedbackBadgeProductAssociation.BadgeId, typeof(Guid)));
                        ProductFeedbackBadgeProductAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.StartDate, typeof(DateTime)));
                        ProductFeedbackBadgeProductAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.FinishDate, typeof(DateTime)));

                        ProductFeedbackBadgeProductDisassociation = new DataTable
                        {
                            Locale = CultureInfo.InvariantCulture
                        };
                        ProductFeedbackBadgeProductDisassociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackBadgeProductRelations.ColumnNames.ProductFeedbackBadgeProductDisassociation.BadgeId, typeof(Guid)));
                        ProductFeedbackBadgeProductDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.StartDate, typeof(DateTime)));
                        ProductFeedbackBadgeProductDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.FinishDate, typeof(DateTime)));
                    }

                }

            }

            public static class GetProductFeedbackBadgeCategoryRelations
            {

                public static class Table
                {

                    public static readonly DataTable ProductFeedbackBadgeCategoryAssociation;
                    public static readonly DataTable ProductFeedbackBadgeCategoryDisassociation;

                    [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "Reviewed.")]
                    static Table()
                    {
                        ProductFeedbackBadgeCategoryAssociation = new DataTable
                        {
                            Locale = CultureInfo.InvariantCulture
                        };

                        ProductFeedbackBadgeCategoryAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackBadgeCategoryRelations.ColumnNames.ProductFeedbackBadgeCategoryAssociation.BadgeId, typeof(Guid)));
                        ProductFeedbackBadgeCategoryAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.StartDate, typeof(DateTime)));
                        ProductFeedbackBadgeCategoryAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.FinishDate, typeof(DateTime)));

                        ProductFeedbackBadgeCategoryDisassociation = new DataTable
                        {
                            Locale = CultureInfo.InvariantCulture
                        };
                        ProductFeedbackBadgeCategoryDisassociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackBadgeCategoryRelations.ColumnNames.ProductFeedbackBadgeCategoryDisassociation.BadgeId, typeof(Guid)));
                        ProductFeedbackBadgeCategoryDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.StartDate, typeof(DateTime)));
                        ProductFeedbackBadgeCategoryDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.FinishDate, typeof(DateTime)));
                    }

                }

            }

            public static class GetProductRatingAttributeProductRelations
            {

                public static class Table
                {

                    public static readonly DataTable ProductRatingAttributeProductAssociation;
                    public static readonly DataTable ProductRatingAttributeProductDisassociation;

                    [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "Reviewed.")]
                    static Table()
                    {
                        ProductRatingAttributeProductAssociation = new DataTable
                        {
                            Locale = CultureInfo.InvariantCulture
                        };
                        ProductRatingAttributeProductAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductRatingAttributeProductRelations.ColumnNames.ProductRatingAttributeProductAssociation.AttributeId, typeof(Guid)));
                        ProductRatingAttributeProductAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.StartDate, typeof(DateTime)));
                        ProductRatingAttributeProductAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.FinishDate, typeof(DateTime)));
                        ProductRatingAttributeProductAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductRatingAttributeProductRelations.ColumnNames.ProductRatingAttributeProductAssociation.DisplayOrder, typeof(int)));

                        ProductRatingAttributeProductDisassociation = new DataTable
                        {
                            Locale = CultureInfo.InvariantCulture
                        };
                        ProductRatingAttributeProductDisassociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductRatingAttributeProductRelations.ColumnNames.ProductRatingAttributeProductDisassociation.AttributeId, typeof(Guid)));
                        ProductRatingAttributeProductDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.StartDate, typeof(DateTime)));
                        ProductRatingAttributeProductDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.FinishDate, typeof(DateTime)));
                    }

                }

            }

            public static class GetProductRatingAttributeCategoryRelations
            {

                public static class Table
                {

                    public static readonly DataTable ProductRatingAttributeCategoryAssociation;
                    public static readonly DataTable ProductRatingAttributeCategoryDisassociation;

                    [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "Reviewed.")]
                    static Table()
                    {
                        ProductRatingAttributeCategoryAssociation = new DataTable
                        {
                            Locale = CultureInfo.InvariantCulture
                        };
                        ProductRatingAttributeCategoryAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductRatingAttributeCategoryRelations.ColumnNames.ProductRatingAttributeCategoryAssociation.AttributeId, typeof(Guid)));
                        ProductRatingAttributeCategoryAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.StartDate, typeof(DateTime)));
                        ProductRatingAttributeCategoryAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.FinishDate, typeof(DateTime)));
                        ProductRatingAttributeCategoryAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductRatingAttributeCategoryRelations.ColumnNames.ProductRatingAttributeCategoryAssociation.DisplayOrder, typeof(int)));

                        ProductRatingAttributeCategoryDisassociation = new DataTable
                        {
                            Locale = CultureInfo.InvariantCulture
                        };
                        ProductRatingAttributeCategoryDisassociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductRatingAttributeCategoryRelations.ColumnNames.ProductRatingAttributeCategoryDisassociation.AttributeId, typeof(Guid)));
                        ProductRatingAttributeCategoryDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.StartDate, typeof(DateTime)));
                        ProductRatingAttributeCategoryDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.FinishDate, typeof(DateTime)));
                    }

                }

            }

            public static class GetProductRecommendationAttributeProductRelations
			{

				public static class Table
				{

					public static readonly DataTable ProductRecommendationAttributeProductAssociation;
					public static readonly DataTable ProductRecommendationAttributeProductDisassociation;

					[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "Reviewed.")]
					static Table()
					{
						ProductRecommendationAttributeProductAssociation = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
                        ProductRecommendationAttributeProductAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductRecommendationAttributeProductRelations.ColumnNames.ProductRecommendationAttributeProductAssociation.AttributeId, typeof(Guid)));
						ProductRecommendationAttributeProductAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.StartDate, typeof(DateTime)));
						ProductRecommendationAttributeProductAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.FinishDate, typeof(DateTime)));
						ProductRecommendationAttributeProductAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductRecommendationAttributeProductRelations.ColumnNames.ProductRecommendationAttributeProductAssociation.DisplayOrder, typeof(int)));

						ProductRecommendationAttributeProductDisassociation = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
                        ProductRecommendationAttributeProductDisassociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductRecommendationAttributeProductRelations.ColumnNames.ProductRecommendationAttributeProductDisassociation.AttributeId, typeof(Guid)));
						ProductRecommendationAttributeProductDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.StartDate, typeof(DateTime)));
						ProductRecommendationAttributeProductDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.FinishDate, typeof(DateTime)));
					}

				}

			}

			public static class GetProductRecommendationAttributeCategoryRelations
			{

				public static class Table
				{

					public static readonly DataTable ProductRecommendationAttributeCategoryAssociation;
					public static readonly DataTable ProductRecommendationAttributeCategoryDisassociation;

					[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "Reviewed.")]
					static Table()
					{
						ProductRecommendationAttributeCategoryAssociation = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
                        ProductRecommendationAttributeCategoryAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductRecommendationAttributeCategoryRelations.ColumnNames.ProductRecommendationAttributeCategoryAssociation.AttributeId, typeof(Guid)));
						ProductRecommendationAttributeCategoryAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.StartDate, typeof(DateTime)));
						ProductRecommendationAttributeCategoryAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.FinishDate, typeof(DateTime)));
						ProductRecommendationAttributeCategoryAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductRecommendationAttributeCategoryRelations.ColumnNames.ProductRecommendationAttributeCategoryAssociation.DisplayOrder, typeof(int)));

						ProductRecommendationAttributeCategoryDisassociation = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
                        ProductRecommendationAttributeCategoryDisassociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductRecommendationAttributeCategoryRelations.ColumnNames.ProductRecommendationAttributeCategoryDisassociation.AttributeId, typeof(Guid)));
						ProductRecommendationAttributeCategoryDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.StartDate, typeof(DateTime)));
						ProductRecommendationAttributeCategoryDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.FinishDate, typeof(DateTime)));
					}

				}

			}

			public static class GetProductReviewAttributeProductRelations
			{

				public static class Table
				{

					public static readonly DataTable ProductReviewAttributeProductAssociation;
					public static readonly DataTable ProductReviewAttributeProductDisassociation;

					[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "Reviewed.")]
					static Table()
					{
						ProductReviewAttributeProductAssociation = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
                        ProductReviewAttributeProductAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductReviewAttributeProductRelations.ColumnNames.ProductReviewAttributeProductAssociation.AttributeId, typeof(Guid)));
						ProductReviewAttributeProductAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.StartDate, typeof(DateTime)));
						ProductReviewAttributeProductAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.FinishDate, typeof(DateTime)));
						ProductReviewAttributeProductAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductReviewAttributeProductRelations.ColumnNames.ProductReviewAttributeProductAssociation.DisplayOrder, typeof(int)));

						ProductReviewAttributeProductDisassociation = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
                        ProductReviewAttributeProductDisassociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductReviewAttributeProductRelations.ColumnNames.ProductReviewAttributeProductDisassociation.AttributeId, typeof(Guid)));
						ProductReviewAttributeProductDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.StartDate, typeof(DateTime)));
						ProductReviewAttributeProductDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.FinishDate, typeof(DateTime)));
					}

				}

			}

			public static class GetProductReviewAttributeCategoryRelations
			{

				public static class Table
				{

					public static readonly DataTable ProductReviewAttributeCategoryAssociation;
					public static readonly DataTable ProductReviewAttributeCategoryDisassociation;

					[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "Reviewed.")]
					static Table()
					{
						ProductReviewAttributeCategoryAssociation = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
                        ProductReviewAttributeCategoryAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductReviewAttributeCategoryRelations.ColumnNames.ProductReviewAttributeCategoryAssociation.AttributeId, typeof(Guid)));
						ProductReviewAttributeCategoryAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.StartDate, typeof(DateTime)));
						ProductReviewAttributeCategoryAssociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeAssociation.FinishDate, typeof(DateTime)));
						ProductReviewAttributeCategoryAssociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductReviewAttributeCategoryRelations.ColumnNames.ProductReviewAttributeCategoryAssociation.DisplayOrder, typeof(int)));

						ProductReviewAttributeCategoryDisassociation = new DataTable
						{
							Locale = CultureInfo.InvariantCulture
						};
                        ProductReviewAttributeCategoryDisassociation.Columns.Add(new DataColumn(ProductFeedbackMetadataProvider.StoredProcedure.GetProductReviewAttributeCategoryRelations.ColumnNames.ProductReviewAttributeCategoryDisassociation.AttributeId, typeof(Guid)));
						ProductReviewAttributeCategoryDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.StartDate, typeof(DateTime)));
						ProductReviewAttributeCategoryDisassociation.Columns.Add(new DataColumn(RelationsProviderTools.ColumnName.AttributeDisassociation.FinishDate, typeof(DateTime)));
					}

				}

			}

		}

		#endregion // Inner Classes and Types

		#region Methods

		#region GetProductFeedbackMetadata

		/// <summary>
		/// Ensures <see cref="ProductFeedbackMetadataProvider.GetProductFeedbackMetadata"/> gets
		/// product feedback metadata from the database.
		/// </summary>
        [SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "Reviewed.")]
        [TestMethod]
		public void TestGetProductFeedbackMetadata()
		{
            DataTable badgeResults;
            DataTable ratingAttributeResults;
			DataTable ratingAttributeLocalizationResults;
			DataTable recommendationAttributeResults;
			DataTable recommendationAttributeLocalizationResults;
			DataTable reviewAttributeResults;
			DataTable reviewAttributeLocalizationResults;
			DataTable[] results;
			DataTableReader reader;
			MockDatabaseCommandExecuteReaderReturns command;
			MockDatabaseConnection connection;
			MockDatabaseConnectionFactory connectionFactory;
			ProductFeedbackMetadataProvider provider;
			ProductFeedbackMetadata metadata;
            ProductFeedbackBadge badge;
			ProductRatingAttribute ratingAttribute;
			ProductRatingAttributeLocalization ratingAttributeLocalization;
			ProductRecommendationAttribute recommendationAttribute;
			ProductRecommendationAttributeLocalization recommendationAttributeLocalization;
			ProductReviewAttribute reviewAttribute;
			ProductReviewAttributeLocalization reviewAttributeLocalization;

            badgeResults = StoredProcedure.GetProductFeedbackMetadata.Table.ProductFeedbackBadge.Clone();
            badgeResults.Rows.Add(Constants.ProductFeedbackBadge.BadgeId.Featured, Constants.ProductFeedbackBadge.WellKnownBadgeCode.Featured);
            badgeResults.Rows.Add(Constants.ProductFeedbackBadge.BadgeId.Top1Contributor, Constants.ProductFeedbackBadge.WellKnownBadgeCode.Top1Contributor);
            badgeResults.Rows.Add(Constants.ProductFeedbackBadge.BadgeId.Top10Contributor, Constants.ProductFeedbackBadge.WellKnownBadgeCode.Top10Contributor);

            ratingAttributeResults = StoredProcedure.GetProductFeedbackMetadata.Table.ProductRatingAttribute.Clone();
			ratingAttributeResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.ImageQuality, "Image quality");
			ratingAttributeResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.SoundQuality, "Sound quality");

			ratingAttributeLocalizationResults = StoredProcedure.GetProductFeedbackMetadata.Table.ProductRatingAttributeLocalization.Clone();
			ratingAttributeLocalizationResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.ImageQuality, TestConstants.CultureId.EnglishCanada, "Image quality");
			ratingAttributeLocalizationResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.ImageQuality, TestConstants.CultureId.FrenchCanada, "Qualité d'image");
			ratingAttributeLocalizationResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.SoundQuality, TestConstants.CultureId.EnglishCanada, "Sound quality");
			ratingAttributeLocalizationResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.SoundQuality, TestConstants.CultureId.FrenchCanada, "Qualité de son");

			recommendationAttributeResults = StoredProcedure.GetProductFeedbackMetadata.Table.ProductRecommendationAttribute.Clone();
			recommendationAttributeResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, "...to a family member?");
			recommendationAttributeResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.Friend, "...to a friend?");

			recommendationAttributeLocalizationResults = StoredProcedure.GetProductFeedbackMetadata.Table.ProductRecommendationAttributeLocalization.Clone();
			recommendationAttributeLocalizationResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, TestConstants.CultureId.EnglishCanada, "...to a family member?");
			recommendationAttributeLocalizationResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, TestConstants.CultureId.FrenchCanada, "...à un membre de la famille?");
			recommendationAttributeLocalizationResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.Friend, TestConstants.CultureId.EnglishCanada, "...to a friend?");
			recommendationAttributeLocalizationResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.Friend, TestConstants.CultureId.FrenchCanada, "...à un ami?");

			reviewAttributeResults = StoredProcedure.GetProductFeedbackMetadata.Table.ProductReviewAttribute.Clone();
			reviewAttributeResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Pros, "Pros");
			reviewAttributeResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Cons, "Cons");

			reviewAttributeLocalizationResults = StoredProcedure.GetProductFeedbackMetadata.Table.ProductReviewAttributeLocalization.Clone();
			reviewAttributeLocalizationResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Pros, TestConstants.CultureId.EnglishCanada, "Pros");
			reviewAttributeLocalizationResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Pros, TestConstants.CultureId.FrenchCanada, "Positifs");
			reviewAttributeLocalizationResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Cons, TestConstants.CultureId.EnglishCanada, "Cons");
			reviewAttributeLocalizationResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Cons, TestConstants.CultureId.FrenchCanada, "Négatifs");

			results = new DataTable[]
			{
                badgeResults,
				ratingAttributeResults,
				ratingAttributeLocalizationResults,
				recommendationAttributeResults,
				recommendationAttributeLocalizationResults,
				reviewAttributeResults,
				reviewAttributeLocalizationResults,
			};

			reader = new DataTableReader(results);

			command = new MockDatabaseCommandExecuteReaderReturns(ProductFeedbackMetadataProvider.DatabaseSchema, ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackMetadata.CommandName, 1, reader);

			connection = new MockDatabaseConnection(command.Object);

			connectionFactory = new MockDatabaseConnectionFactory(TestConstants.TenantId.JTLeigh, ProductFeedbackMetadataProvider.DatabaseKeyReadOperations, connection.Object);

			provider = new ProductFeedbackMetadataProvider()
			{
				DatabaseConnectionFactory = connectionFactory.Object,
			};

			metadata = provider.GetProductFeedbackMetadata(TestConstants.TenantId.JTLeigh);

			command.VerifyAll();
			connection.VerifyAll();

			Assert.IsNotNull(metadata);

            Assert.AreEqual(3, metadata.Badges.Count);

            Assert.IsTrue(metadata.Badges.TryGetValue(Constants.ProductFeedbackBadge.BadgeId.Featured, out badge));
            Assert.AreEqual(Constants.ProductFeedbackBadge.BadgeId.Featured, badge.BadgeId);
            Assert.AreEqual(Constants.ProductFeedbackBadge.WellKnownBadgeCode.Featured, badge.WellKnownBadgeCode);
            Assert.IsTrue(metadata.Badges.TryGetValue(Constants.ProductFeedbackBadge.BadgeId.Top1Contributor, out badge));
            Assert.AreEqual(Constants.ProductFeedbackBadge.BadgeId.Top1Contributor, badge.BadgeId);
            Assert.AreEqual(Constants.ProductFeedbackBadge.WellKnownBadgeCode.Top1Contributor, badge.WellKnownBadgeCode);
            Assert.IsTrue(metadata.Badges.TryGetValue(Constants.ProductFeedbackBadge.BadgeId.Top10Contributor, out badge));
            Assert.AreEqual(Constants.ProductFeedbackBadge.BadgeId.Top10Contributor, badge.BadgeId);
            Assert.AreEqual(Constants.ProductFeedbackBadge.WellKnownBadgeCode.Top10Contributor, badge.WellKnownBadgeCode);

			Assert.AreEqual(2, metadata.RatingAttributes.Count);

			Assert.IsTrue(metadata.RatingAttributes.TryGetValue(Constants.ProductRatingAttribute.AttributeId.ImageQuality, out ratingAttribute));
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.ImageQuality, ratingAttribute.AttributeId);
			Assert.AreEqual("Image quality", ratingAttribute.DefaultText);
			Assert.AreEqual(2, ratingAttribute.Localizations.Count);
			Assert.IsTrue(ratingAttribute.Localizations.TryGetValue(TestConstants.CultureId.EnglishCanada, out ratingAttributeLocalization));
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.ImageQuality, ratingAttributeLocalization.AttributeId);
			Assert.AreEqual(TestConstants.CultureId.EnglishCanada, ratingAttributeLocalization.CultureId);
			Assert.AreEqual("Image quality", ratingAttributeLocalization.Text);
			Assert.IsTrue(ratingAttribute.Localizations.TryGetValue(TestConstants.CultureId.FrenchCanada, out ratingAttributeLocalization));
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.ImageQuality, ratingAttributeLocalization.AttributeId);
			Assert.AreEqual(TestConstants.CultureId.FrenchCanada, ratingAttributeLocalization.CultureId);
			Assert.AreEqual("Qualité d'image", ratingAttributeLocalization.Text);

			Assert.IsTrue(metadata.RatingAttributes.TryGetValue(Constants.ProductRatingAttribute.AttributeId.SoundQuality, out ratingAttribute));
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.SoundQuality, ratingAttribute.AttributeId);
			Assert.AreEqual("Sound quality", ratingAttribute.DefaultText);
			Assert.AreEqual(2, ratingAttribute.Localizations.Count);
			Assert.IsTrue(ratingAttribute.Localizations.TryGetValue(TestConstants.CultureId.EnglishCanada, out ratingAttributeLocalization));
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.SoundQuality, ratingAttributeLocalization.AttributeId);
			Assert.AreEqual(TestConstants.CultureId.EnglishCanada, ratingAttributeLocalization.CultureId);
			Assert.AreEqual("Sound quality", ratingAttributeLocalization.Text);
			Assert.IsTrue(ratingAttribute.Localizations.TryGetValue(TestConstants.CultureId.FrenchCanada, out ratingAttributeLocalization));
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.SoundQuality, ratingAttributeLocalization.AttributeId);
			Assert.AreEqual(TestConstants.CultureId.FrenchCanada, ratingAttributeLocalization.CultureId);
			Assert.AreEqual("Qualité de son", ratingAttributeLocalization.Text);

			Assert.AreEqual(2, metadata.RecommendationAttributes.Count);

			Assert.IsTrue(metadata.RecommendationAttributes.TryGetValue(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, out recommendationAttribute));
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, recommendationAttribute.AttributeId);
			Assert.AreEqual("...to a family member?", recommendationAttribute.DefaultText);
			Assert.AreEqual(2, recommendationAttribute.Localizations.Count);
			Assert.IsTrue(recommendationAttribute.Localizations.TryGetValue(TestConstants.CultureId.EnglishCanada, out recommendationAttributeLocalization));
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, recommendationAttributeLocalization.AttributeId);
			Assert.AreEqual(TestConstants.CultureId.EnglishCanada, recommendationAttributeLocalization.CultureId);
			Assert.AreEqual("...to a family member?", recommendationAttributeLocalization.Text);
			Assert.IsTrue(recommendationAttribute.Localizations.TryGetValue(TestConstants.CultureId.FrenchCanada, out recommendationAttributeLocalization));
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, recommendationAttributeLocalization.AttributeId);
			Assert.AreEqual(TestConstants.CultureId.FrenchCanada, recommendationAttributeLocalization.CultureId);
			Assert.AreEqual("...à un membre de la famille?", recommendationAttributeLocalization.Text);

			Assert.IsTrue(metadata.RecommendationAttributes.TryGetValue(Constants.ProductRecommendationAttribute.AttributeId.Friend, out recommendationAttribute));
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.Friend, recommendationAttribute.AttributeId);
			Assert.AreEqual("...to a friend?", recommendationAttribute.DefaultText);
			Assert.AreEqual(2, recommendationAttribute.Localizations.Count);
			Assert.IsTrue(recommendationAttribute.Localizations.TryGetValue(TestConstants.CultureId.EnglishCanada, out recommendationAttributeLocalization));
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.Friend, recommendationAttributeLocalization.AttributeId);
			Assert.AreEqual(TestConstants.CultureId.EnglishCanada, recommendationAttributeLocalization.CultureId);
			Assert.AreEqual("...to a friend?", recommendationAttributeLocalization.Text);
			Assert.IsTrue(recommendationAttribute.Localizations.TryGetValue(TestConstants.CultureId.FrenchCanada, out recommendationAttributeLocalization));
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.Friend, recommendationAttributeLocalization.AttributeId);
			Assert.AreEqual(TestConstants.CultureId.FrenchCanada, recommendationAttributeLocalization.CultureId);
			Assert.AreEqual("...à un ami?", recommendationAttributeLocalization.Text);

			Assert.AreEqual(2, metadata.ReviewAttributes.Count);

			Assert.IsTrue(metadata.ReviewAttributes.TryGetValue(Constants.ProductReviewAttribute.AttributeId.Pros, out reviewAttribute));
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Pros, reviewAttribute.AttributeId);
			Assert.AreEqual("Pros", reviewAttribute.DefaultText);
			Assert.AreEqual(2, reviewAttribute.Localizations.Count);
			Assert.IsTrue(reviewAttribute.Localizations.TryGetValue(TestConstants.CultureId.EnglishCanada, out reviewAttributeLocalization));
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Pros, reviewAttributeLocalization.AttributeId);
			Assert.AreEqual(TestConstants.CultureId.EnglishCanada, reviewAttributeLocalization.CultureId);
			Assert.AreEqual("Pros", reviewAttributeLocalization.Text);
			Assert.IsTrue(reviewAttribute.Localizations.TryGetValue(TestConstants.CultureId.FrenchCanada, out reviewAttributeLocalization));
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Pros, reviewAttributeLocalization.AttributeId);
			Assert.AreEqual(TestConstants.CultureId.FrenchCanada, reviewAttributeLocalization.CultureId);
			Assert.AreEqual("Positifs", reviewAttributeLocalization.Text);

			Assert.IsTrue(metadata.ReviewAttributes.TryGetValue(Constants.ProductReviewAttribute.AttributeId.Cons, out reviewAttribute));
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Cons, reviewAttribute.AttributeId);
			Assert.AreEqual("Cons", reviewAttribute.DefaultText);
			Assert.AreEqual(2, reviewAttribute.Localizations.Count);
			Assert.IsTrue(reviewAttribute.Localizations.TryGetValue(TestConstants.CultureId.EnglishCanada, out reviewAttributeLocalization));
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Cons, reviewAttributeLocalization.AttributeId);
			Assert.AreEqual(TestConstants.CultureId.EnglishCanada, reviewAttributeLocalization.CultureId);
			Assert.AreEqual("Cons", reviewAttributeLocalization.Text);
			Assert.IsTrue(reviewAttribute.Localizations.TryGetValue(TestConstants.CultureId.FrenchCanada, out reviewAttributeLocalization));
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Cons, reviewAttributeLocalization.AttributeId);
			Assert.AreEqual(TestConstants.CultureId.FrenchCanada, reviewAttributeLocalization.CultureId);
			Assert.AreEqual("Négatifs", reviewAttributeLocalization.Text);
		}

		#endregion // GetProductFeedbackMetadata

        #region GetProductRatingAttributeProductRelations

        /// <summary>
        /// FIXME
        /// </summary>
        [TestMethod]
        public void TestGetProductFeedbackBadgeProductRelations()
        {
            DataTable associationResults;
            DataTable disassociationResults;
            DataTable[] results;
            DataTableReader reader;
            MockDatabaseCommandExecuteReaderReturns command;
            MockDatabaseConnection connection;
            MockDatabaseConnectionFactory connectionFactory;
            ProductFeedbackMetadataProvider provider;
            ProductFeedbackBadgeProductRelations relations;

            associationResults = StoredProcedure.GetProductFeedbackBadgeProductRelations.Table.ProductFeedbackBadgeProductAssociation.Clone();
            associationResults.Rows.Add(Constants.ProductFeedbackBadge.BadgeId.Featured, new DateTime(2008, 06, 01), new DateTime(2008, 07, 01));
            associationResults.Rows.Add(Constants.ProductFeedbackBadge.BadgeId.Top1Contributor, new DateTime(2008, 08, 01), null);

            disassociationResults = StoredProcedure.GetProductFeedbackBadgeProductRelations.Table.ProductFeedbackBadgeProductDisassociation.Clone();
            disassociationResults.Rows.Add(Constants.ProductFeedbackBadge.BadgeId.Featured, new DateTime(2008, 06, 15), new DateTime(2008, 06, 25));
            disassociationResults.Rows.Add(Constants.ProductFeedbackBadge.BadgeId.Top1Contributor, new DateTime(2008, 08, 15), null);

            results = new DataTable[]
			{
				associationResults,
				disassociationResults,
			};

            reader = new DataTableReader(results);

            command = new MockDatabaseCommandExecuteReaderReturns(ProductFeedbackMetadataProvider.DatabaseSchema, ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackBadgeProductRelations.CommandName, 3, reader);

            connection = new MockDatabaseConnection(command.Object);

            connectionFactory = new MockDatabaseConnectionFactory(TestConstants.TenantId.JTLeigh, ProductFeedbackMetadataProvider.DatabaseKeyReadOperations, connection.Object);

            provider = new ProductFeedbackMetadataProvider()
            {
                DatabaseConnectionFactory = connectionFactory.Object,
            };

            relations = provider.GetProductFeedbackBadgeProductRelations(TestConstants.TenantId.JTLeigh, "BaseCatalog", "123");

            command.VerifyAll();
            connection.VerifyAll();

            Assert.IsNotNull(relations);

            Assert.AreEqual(2, relations.Associations.Count);
            Assert.AreEqual(Constants.ProductFeedbackBadge.BadgeId.Featured, relations.Associations[0].AssociatedItemId);
            Assert.AreEqual(new DateTime(2008, 06, 01), relations.Associations[0].StartDate);
            Assert.AreEqual(new DateTime(2008, 07, 01), relations.Associations[0].FinishDate);
            Assert.AreEqual(Constants.ProductFeedbackBadge.BadgeId.Top1Contributor, relations.Associations[1].AssociatedItemId);
            Assert.AreEqual(new DateTime(2008, 08, 01), relations.Associations[1].StartDate);
            Assert.IsNull(relations.Associations[1].FinishDate);

            Assert.AreEqual(2, relations.Disassociations.Count);

            Assert.AreEqual(2, relations.Associations.Count);
            Assert.AreEqual(Constants.ProductFeedbackBadge.BadgeId.Featured, relations.Disassociations[0].DisassociatedItemId);
            Assert.AreEqual(new DateTime(2008, 06, 15), relations.Disassociations[0].StartDate);
            Assert.AreEqual(new DateTime(2008, 06, 25), relations.Disassociations[0].FinishDate);
            Assert.AreEqual(Constants.ProductFeedbackBadge.BadgeId.Top1Contributor, relations.Disassociations[1].DisassociatedItemId);
            Assert.AreEqual(new DateTime(2008, 08, 15), relations.Disassociations[1].StartDate);
            Assert.IsNull(relations.Disassociations[1].FinishDate);
        }

        #endregion // GetProductFeedbackBadgeProductRelations

        #region GetProductFeedbackBadgeCategoryRelations

        /// <summary>
        /// FIXME
        /// </summary>
        [TestMethod]
        public void TestGetProductFeedbackBadgeCategoryRelations()
        {
            DataTable associationResults;
            DataTable disassociationResults;
            DataTable[] results;
            DataTableReader reader;
            MockDatabaseCommandExecuteReaderReturns command;
            MockDatabaseConnection connection;
            MockDatabaseConnectionFactory connectionFactory;
            ProductFeedbackMetadataProvider provider;
            ProductFeedbackBadgeCategoryRelations relations;

            associationResults = StoredProcedure.GetProductFeedbackBadgeCategoryRelations.Table.ProductFeedbackBadgeCategoryAssociation.Clone();
            associationResults.Rows.Add(Constants.ProductFeedbackBadge.BadgeId.Featured, new DateTime(2008, 06, 01), new DateTime(2008, 07, 01));
            associationResults.Rows.Add(Constants.ProductFeedbackBadge.BadgeId.Top1Contributor, new DateTime(2008, 08, 01), null);

            disassociationResults = StoredProcedure.GetProductFeedbackBadgeCategoryRelations.Table.ProductFeedbackBadgeCategoryDisassociation.Clone();
            disassociationResults.Rows.Add(Constants.ProductFeedbackBadge.BadgeId.Featured, new DateTime(2008, 06, 15), new DateTime(2008, 06, 25));
            disassociationResults.Rows.Add(Constants.ProductFeedbackBadge.BadgeId.Top1Contributor, new DateTime(2008, 08, 15), null);

            results = new DataTable[]
			{
				associationResults,
				disassociationResults,
			};

            reader = new DataTableReader(results);

            command = new MockDatabaseCommandExecuteReaderReturns(ProductFeedbackMetadataProvider.DatabaseSchema, ProductFeedbackMetadataProvider.StoredProcedure.GetProductFeedbackBadgeCategoryRelations.CommandName, 3, reader);

            connection = new MockDatabaseConnection(command.Object);

            connectionFactory = new MockDatabaseConnectionFactory(TestConstants.TenantId.JTLeigh, ProductFeedbackMetadataProvider.DatabaseKeyReadOperations, connection.Object);

            provider = new ProductFeedbackMetadataProvider()
            {
                DatabaseConnectionFactory = connectionFactory.Object,
            };

            relations = provider.GetProductFeedbackBadgeCategoryRelations(TestConstants.TenantId.JTLeigh, "BaseCatalog", "ABC");

            command.VerifyAll();
            connection.VerifyAll();

            Assert.IsNotNull(relations);

            Assert.AreEqual(2, relations.Associations.Count);
            Assert.AreEqual(Constants.ProductFeedbackBadge.BadgeId.Featured, relations.Associations[0].AssociatedItemId);
            Assert.AreEqual(new DateTime(2008, 06, 01), relations.Associations[0].StartDate);
            Assert.AreEqual(new DateTime(2008, 07, 01), relations.Associations[0].FinishDate);
            Assert.AreEqual(Constants.ProductFeedbackBadge.BadgeId.Top1Contributor, relations.Associations[1].AssociatedItemId);
            Assert.AreEqual(new DateTime(2008, 08, 01), relations.Associations[1].StartDate);
            Assert.IsNull(relations.Associations[1].FinishDate);

            Assert.AreEqual(2, relations.Disassociations.Count);

            Assert.AreEqual(2, relations.Associations.Count);
            Assert.AreEqual(Constants.ProductFeedbackBadge.BadgeId.Featured, relations.Disassociations[0].DisassociatedItemId);
            Assert.AreEqual(new DateTime(2008, 06, 15), relations.Disassociations[0].StartDate);
            Assert.AreEqual(new DateTime(2008, 06, 25), relations.Disassociations[0].FinishDate);
            Assert.AreEqual(Constants.ProductFeedbackBadge.BadgeId.Top1Contributor, relations.Disassociations[1].DisassociatedItemId);
            Assert.AreEqual(new DateTime(2008, 08, 15), relations.Disassociations[1].StartDate);
            Assert.IsNull(relations.Disassociations[1].FinishDate);
        }

        #endregion // GetProductFeedbackBadgeCategoryRelations

        #region GetProductRatingAttributeProductRelations

		/// <summary>
		/// FIXME
		/// </summary>
		[TestMethod]
		public void TestGetProductRatingAttributeProductRelations()
		{
			DataTable associationResults;
			DataTable disassociationResults;
			DataTable[] results;
			DataTableReader reader;
			MockDatabaseCommandExecuteReaderReturns command;
			MockDatabaseConnection connection;
			MockDatabaseConnectionFactory connectionFactory;
			ProductFeedbackMetadataProvider provider;
			ProductRatingAttributeProductRelations relations;

			associationResults = StoredProcedure.GetProductRatingAttributeProductRelations.Table.ProductRatingAttributeProductAssociation.Clone();
			associationResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.ImageQuality, new DateTime(2008, 06, 01), new DateTime(2008, 07, 01), 10);
			associationResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.SoundQuality, new DateTime(2008, 08, 01), null, 20);

			disassociationResults = StoredProcedure.GetProductRatingAttributeProductRelations.Table.ProductRatingAttributeProductDisassociation.Clone();
			disassociationResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.ImageQuality, new DateTime(2008, 06, 15), new DateTime(2008, 06, 25));
			disassociationResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.SoundQuality, new DateTime(2008, 08, 15), null);

			results = new DataTable[]
			{
				associationResults,
				disassociationResults,
			};

			reader = new DataTableReader(results);

			command = new MockDatabaseCommandExecuteReaderReturns(ProductFeedbackMetadataProvider.DatabaseSchema, ProductFeedbackMetadataProvider.StoredProcedure.GetProductRatingAttributeProductRelations.CommandName, 3, reader);

			connection = new MockDatabaseConnection(command.Object);

			connectionFactory = new MockDatabaseConnectionFactory(TestConstants.TenantId.JTLeigh, ProductFeedbackMetadataProvider.DatabaseKeyReadOperations, connection.Object);

			provider = new ProductFeedbackMetadataProvider()
			{
				DatabaseConnectionFactory = connectionFactory.Object,
			};

            relations = provider.GetProductRatingAttributeProductRelations(TestConstants.TenantId.JTLeigh, "BaseCatalog", "123");

			command.VerifyAll();
			connection.VerifyAll();

			Assert.IsNotNull(relations);

			Assert.AreEqual(2, relations.Associations.Count);
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.ImageQuality, relations.Associations[0].AssociatedItemId);
			Assert.AreEqual(new DateTime(2008, 06, 01), relations.Associations[0].StartDate);
			Assert.AreEqual(new DateTime(2008, 07, 01), relations.Associations[0].FinishDate);
			Assert.AreEqual(10, relations.Associations[0].DisplayOrder);
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.SoundQuality, relations.Associations[1].AssociatedItemId);
			Assert.AreEqual(new DateTime(2008, 08, 01), relations.Associations[1].StartDate);
			Assert.IsNull(relations.Associations[1].FinishDate);
			Assert.AreEqual(20, relations.Associations[1].DisplayOrder);

			Assert.AreEqual(2, relations.Disassociations.Count);

			Assert.AreEqual(2, relations.Associations.Count);
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.ImageQuality, relations.Disassociations[0].DisassociatedItemId);
			Assert.AreEqual(new DateTime(2008, 06, 15), relations.Disassociations[0].StartDate);
			Assert.AreEqual(new DateTime(2008, 06, 25), relations.Disassociations[0].FinishDate);
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.SoundQuality, relations.Disassociations[1].DisassociatedItemId);
			Assert.AreEqual(new DateTime(2008, 08, 15), relations.Disassociations[1].StartDate);
			Assert.IsNull(relations.Disassociations[1].FinishDate);
		}

		#endregion // GetProductRatingAttributeProductRelations

		#region GetProductRatingAttributeCategoryRelations

		/// <summary>
		/// FIXME
		/// </summary>
		[TestMethod]
		public void TestGetProductRatingAttributeCategoryRelations()
		{
			DataTable associationResults;
			DataTable disassociationResults;
			DataTable[] results;
			DataTableReader reader;
			MockDatabaseCommandExecuteReaderReturns command;
			MockDatabaseConnection connection;
			MockDatabaseConnectionFactory connectionFactory;
			ProductFeedbackMetadataProvider provider;
			ProductRatingAttributeCategoryRelations relations;

			associationResults = StoredProcedure.GetProductRatingAttributeCategoryRelations.Table.ProductRatingAttributeCategoryAssociation.Clone();
			associationResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.ImageQuality, new DateTime(2008, 06, 01), new DateTime(2008, 07, 01), 10);
			associationResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.SoundQuality, new DateTime(2008, 08, 01), null, 20);

			disassociationResults = StoredProcedure.GetProductRatingAttributeCategoryRelations.Table.ProductRatingAttributeCategoryDisassociation.Clone();
			disassociationResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.ImageQuality, new DateTime(2008, 06, 15), new DateTime(2008, 06, 25));
			disassociationResults.Rows.Add(Constants.ProductRatingAttribute.AttributeId.SoundQuality, new DateTime(2008, 08, 15), null);

			results = new DataTable[]
			{
				associationResults,
				disassociationResults,
			};

			reader = new DataTableReader(results);

			command = new MockDatabaseCommandExecuteReaderReturns(ProductFeedbackMetadataProvider.DatabaseSchema, ProductFeedbackMetadataProvider.StoredProcedure.GetProductRatingAttributeCategoryRelations.CommandName, 3, reader);

			connection = new MockDatabaseConnection(command.Object);

			connectionFactory = new MockDatabaseConnectionFactory(TestConstants.TenantId.JTLeigh, ProductFeedbackMetadataProvider.DatabaseKeyReadOperations, connection.Object);

			provider = new ProductFeedbackMetadataProvider()
			{
				DatabaseConnectionFactory = connectionFactory.Object,
			};

            relations = provider.GetProductRatingAttributeCategoryRelations(TestConstants.TenantId.JTLeigh, "BaseCatalog", "ABC");

			command.VerifyAll();
			connection.VerifyAll();

			Assert.IsNotNull(relations);

			Assert.AreEqual(2, relations.Associations.Count);
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.ImageQuality, relations.Associations[0].AssociatedItemId);
			Assert.AreEqual(new DateTime(2008, 06, 01), relations.Associations[0].StartDate);
			Assert.AreEqual(new DateTime(2008, 07, 01), relations.Associations[0].FinishDate);
			Assert.AreEqual(10, relations.Associations[0].DisplayOrder);
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.SoundQuality, relations.Associations[1].AssociatedItemId);
			Assert.AreEqual(new DateTime(2008, 08, 01), relations.Associations[1].StartDate);
			Assert.IsNull(relations.Associations[1].FinishDate);
			Assert.AreEqual(20, relations.Associations[1].DisplayOrder);

			Assert.AreEqual(2, relations.Disassociations.Count);

			Assert.AreEqual(2, relations.Associations.Count);
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.ImageQuality, relations.Disassociations[0].DisassociatedItemId);
			Assert.AreEqual(new DateTime(2008, 06, 15), relations.Disassociations[0].StartDate);
			Assert.AreEqual(new DateTime(2008, 06, 25), relations.Disassociations[0].FinishDate);
			Assert.AreEqual(Constants.ProductRatingAttribute.AttributeId.SoundQuality, relations.Disassociations[1].DisassociatedItemId);
			Assert.AreEqual(new DateTime(2008, 08, 15), relations.Disassociations[1].StartDate);
			Assert.IsNull(relations.Disassociations[1].FinishDate);
		}

		#endregion // GetProductRatingAttributeCategoryRelations

		#region GetProductRecommendationAttributeProductRelations

		/// <summary>
		/// FIXME
		/// </summary>
		[TestMethod]
		public void TestGetProductRecommendationAttributeProductRelations()
		{
			DataTable associationResults;
			DataTable disassociationResults;
			DataTable[] results;
			DataTableReader reader;
			MockDatabaseCommandExecuteReaderReturns command;
			MockDatabaseConnection connection;
			MockDatabaseConnectionFactory connectionFactory;
			ProductFeedbackMetadataProvider provider;
			ProductRecommendationAttributeProductRelations relations;

			associationResults = StoredProcedure.GetProductRecommendationAttributeProductRelations.Table.ProductRecommendationAttributeProductAssociation.Clone();
			associationResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, new DateTime(2008, 06, 01), new DateTime(2008, 07, 01), 10);
			associationResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.Friend, new DateTime(2008, 08, 01), null, 20);

			disassociationResults = StoredProcedure.GetProductRecommendationAttributeProductRelations.Table.ProductRecommendationAttributeProductDisassociation.Clone();
			disassociationResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, new DateTime(2008, 06, 15), new DateTime(2008, 06, 25));
			disassociationResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.Friend, new DateTime(2008, 08, 15), null);

			results = new DataTable[]
			{
				associationResults,
				disassociationResults,
			};

			reader = new DataTableReader(results);

			command = new MockDatabaseCommandExecuteReaderReturns(ProductFeedbackMetadataProvider.DatabaseSchema, ProductFeedbackMetadataProvider.StoredProcedure.GetProductRecommendationAttributeProductRelations.CommandName, 3, reader);

			connection = new MockDatabaseConnection(command.Object);

			connectionFactory = new MockDatabaseConnectionFactory(TestConstants.TenantId.JTLeigh, ProductFeedbackMetadataProvider.DatabaseKeyReadOperations, connection.Object);

			provider = new ProductFeedbackMetadataProvider()
			{
				DatabaseConnectionFactory = connectionFactory.Object,
			};

            relations = provider.GetProductRecommendationAttributeProductRelations(TestConstants.TenantId.JTLeigh, "BaseCatalog", "123");

			command.VerifyAll();
			connection.VerifyAll();

			Assert.IsNotNull(relations);

			Assert.AreEqual(2, relations.Associations.Count);
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, relations.Associations[0].AssociatedItemId);
			Assert.AreEqual(new DateTime(2008, 06, 01), relations.Associations[0].StartDate);
			Assert.AreEqual(new DateTime(2008, 07, 01), relations.Associations[0].FinishDate);
			Assert.AreEqual(10, relations.Associations[0].DisplayOrder);
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.Friend, relations.Associations[1].AssociatedItemId);
			Assert.AreEqual(new DateTime(2008, 08, 01), relations.Associations[1].StartDate);
			Assert.IsNull(relations.Associations[1].FinishDate);
			Assert.AreEqual(20, relations.Associations[1].DisplayOrder);

			Assert.AreEqual(2, relations.Disassociations.Count);

			Assert.AreEqual(2, relations.Associations.Count);
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, relations.Disassociations[0].DisassociatedItemId);
			Assert.AreEqual(new DateTime(2008, 06, 15), relations.Disassociations[0].StartDate);
			Assert.AreEqual(new DateTime(2008, 06, 25), relations.Disassociations[0].FinishDate);
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.Friend, relations.Disassociations[1].DisassociatedItemId);
			Assert.AreEqual(new DateTime(2008, 08, 15), relations.Disassociations[1].StartDate);
			Assert.IsNull(relations.Disassociations[1].FinishDate);
		}

		#endregion // GetProductRecommendationAttributeProductRelations

		#region GetProductRecommendationAttributeCategoryRelations

		/// <summary>
		/// FIXME
		/// </summary>
		[TestMethod]
		public void TestGetProductRecommendationAttributeCategoryRelations()
		{
			DataTable associationResults;
			DataTable disassociationResults;
			DataTable[] results;
			DataTableReader reader;
			MockDatabaseCommandExecuteReaderReturns command;
			MockDatabaseConnection connection;
			MockDatabaseConnectionFactory connectionFactory;
			ProductFeedbackMetadataProvider provider;
			ProductRecommendationAttributeCategoryRelations relations;

			associationResults = StoredProcedure.GetProductRecommendationAttributeCategoryRelations.Table.ProductRecommendationAttributeCategoryAssociation.Clone();
			associationResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, new DateTime(2008, 06, 01), new DateTime(2008, 07, 01), 10);
			associationResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.Friend, new DateTime(2008, 08, 01), null, 20);

			disassociationResults = StoredProcedure.GetProductRecommendationAttributeCategoryRelations.Table.ProductRecommendationAttributeCategoryDisassociation.Clone();
			disassociationResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, new DateTime(2008, 06, 15), new DateTime(2008, 06, 25));
			disassociationResults.Rows.Add(Constants.ProductRecommendationAttribute.AttributeId.Friend, new DateTime(2008, 08, 15), null);

			results = new DataTable[]
			{
				associationResults,
				disassociationResults,
			};

			reader = new DataTableReader(results);

			command = new MockDatabaseCommandExecuteReaderReturns(ProductFeedbackMetadataProvider.DatabaseSchema, ProductFeedbackMetadataProvider.StoredProcedure.GetProductRecommendationAttributeCategoryRelations.CommandName, 3, reader);

			connection = new MockDatabaseConnection(command.Object);

			connectionFactory = new MockDatabaseConnectionFactory(TestConstants.TenantId.JTLeigh, ProductFeedbackMetadataProvider.DatabaseKeyReadOperations, connection.Object);

			provider = new ProductFeedbackMetadataProvider()
			{
				DatabaseConnectionFactory = connectionFactory.Object,
			};

            relations = provider.GetProductRecommendationAttributeCategoryRelations(TestConstants.TenantId.JTLeigh, "BaseCatalog", "ABC");

			command.VerifyAll();
			connection.VerifyAll();

			Assert.IsNotNull(relations);

			Assert.AreEqual(2, relations.Associations.Count);
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, relations.Associations[0].AssociatedItemId);
			Assert.AreEqual(new DateTime(2008, 06, 01), relations.Associations[0].StartDate);
			Assert.AreEqual(new DateTime(2008, 07, 01), relations.Associations[0].FinishDate);
			Assert.AreEqual(10, relations.Associations[0].DisplayOrder);
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.Friend, relations.Associations[1].AssociatedItemId);
			Assert.AreEqual(new DateTime(2008, 08, 01), relations.Associations[1].StartDate);
			Assert.IsNull(relations.Associations[1].FinishDate);
			Assert.AreEqual(20, relations.Associations[1].DisplayOrder);

			Assert.AreEqual(2, relations.Disassociations.Count);

			Assert.AreEqual(2, relations.Associations.Count);
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.FamilyMember, relations.Disassociations[0].DisassociatedItemId);
			Assert.AreEqual(new DateTime(2008, 06, 15), relations.Disassociations[0].StartDate);
			Assert.AreEqual(new DateTime(2008, 06, 25), relations.Disassociations[0].FinishDate);
			Assert.AreEqual(Constants.ProductRecommendationAttribute.AttributeId.Friend, relations.Disassociations[1].DisassociatedItemId);
			Assert.AreEqual(new DateTime(2008, 08, 15), relations.Disassociations[1].StartDate);
			Assert.IsNull(relations.Disassociations[1].FinishDate);
		}

		#endregion // GetProductRecommendationAttributeCategoryRelations

		#region GetProductReviewAttributeProductRelations

		/// <summary>
		/// FIXME
		/// </summary>
		[TestMethod]
		public void TestGetProductReviewAttributeProductRelations()
		{
			DataTable associationResults;
			DataTable disassociationResults;
			DataTable[] results;
			DataTableReader reader;
			MockDatabaseCommandExecuteReaderReturns command;
			MockDatabaseConnection connection;
			MockDatabaseConnectionFactory connectionFactory;
			ProductFeedbackMetadataProvider provider;
			ProductReviewAttributeProductRelations relations;

			associationResults = StoredProcedure.GetProductReviewAttributeProductRelations.Table.ProductReviewAttributeProductAssociation.Clone();
			associationResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Pros, new DateTime(2008, 06, 01), new DateTime(2008, 07, 01), 10);
			associationResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Cons, new DateTime(2008, 08, 01), null, 20);

			disassociationResults = StoredProcedure.GetProductReviewAttributeProductRelations.Table.ProductReviewAttributeProductDisassociation.Clone();
			disassociationResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Pros, new DateTime(2008, 06, 15), new DateTime(2008, 06, 25));
			disassociationResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Cons, new DateTime(2008, 08, 15), null);

			results = new DataTable[]
			{
				associationResults,
				disassociationResults,
			};

			reader = new DataTableReader(results);

			command = new MockDatabaseCommandExecuteReaderReturns(ProductFeedbackMetadataProvider.DatabaseSchema, ProductFeedbackMetadataProvider.StoredProcedure.GetProductReviewAttributeProductRelations.CommandName, 3, reader);

			connection = new MockDatabaseConnection(command.Object);

			connectionFactory = new MockDatabaseConnectionFactory(TestConstants.TenantId.JTLeigh, ProductFeedbackMetadataProvider.DatabaseKeyReadOperations, connection.Object);

			provider = new ProductFeedbackMetadataProvider()
			{
				DatabaseConnectionFactory = connectionFactory.Object,
			};

            relations = provider.GetProductReviewAttributeProductRelations(TestConstants.TenantId.JTLeigh, "BaseCatalog", "123");

			command.VerifyAll();
			connection.VerifyAll();

			Assert.IsNotNull(relations);

			Assert.AreEqual(2, relations.Associations.Count);
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Pros, relations.Associations[0].AssociatedItemId);
			Assert.AreEqual(new DateTime(2008, 06, 01), relations.Associations[0].StartDate);
			Assert.AreEqual(new DateTime(2008, 07, 01), relations.Associations[0].FinishDate);
			Assert.AreEqual(10, relations.Associations[0].DisplayOrder);
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Cons, relations.Associations[1].AssociatedItemId);
			Assert.AreEqual(new DateTime(2008, 08, 01), relations.Associations[1].StartDate);
			Assert.IsNull(relations.Associations[1].FinishDate);
			Assert.AreEqual(20, relations.Associations[1].DisplayOrder);

			Assert.AreEqual(2, relations.Disassociations.Count);

			Assert.AreEqual(2, relations.Associations.Count);
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Pros, relations.Disassociations[0].DisassociatedItemId);
			Assert.AreEqual(new DateTime(2008, 06, 15), relations.Disassociations[0].StartDate);
			Assert.AreEqual(new DateTime(2008, 06, 25), relations.Disassociations[0].FinishDate);
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Cons, relations.Disassociations[1].DisassociatedItemId);
			Assert.AreEqual(new DateTime(2008, 08, 15), relations.Disassociations[1].StartDate);
			Assert.IsNull(relations.Disassociations[1].FinishDate);
		}

		#endregion // GetProductReviewAttributeProductRelations

		#region GetProductReviewAttributeCategoryRelations

		/// <summary>
		/// FIXME
		/// </summary>
		[TestMethod]
		public void TestGetProductReviewAttributeCategoryRelations()
		{
			DataTable associationResults;
			DataTable disassociationResults;
			DataTable[] results;
			DataTableReader reader;
			MockDatabaseCommandExecuteReaderReturns command;
			MockDatabaseConnection connection;
			MockDatabaseConnectionFactory connectionFactory;
			ProductFeedbackMetadataProvider provider;
			ProductReviewAttributeCategoryRelations relations;

			associationResults = StoredProcedure.GetProductReviewAttributeCategoryRelations.Table.ProductReviewAttributeCategoryAssociation.Clone();
			associationResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Pros, new DateTime(2008, 06, 01), new DateTime(2008, 07, 01), 10);
			associationResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Cons, new DateTime(2008, 08, 01), null, 20);

			disassociationResults = StoredProcedure.GetProductReviewAttributeCategoryRelations.Table.ProductReviewAttributeCategoryDisassociation.Clone();
			disassociationResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Pros, new DateTime(2008, 06, 15), new DateTime(2008, 06, 25));
			disassociationResults.Rows.Add(Constants.ProductReviewAttribute.AttributeId.Cons, new DateTime(2008, 08, 15), null);

			results = new DataTable[]
			{
				associationResults,
				disassociationResults,
			};

			reader = new DataTableReader(results);

			command = new MockDatabaseCommandExecuteReaderReturns(ProductFeedbackMetadataProvider.DatabaseSchema, ProductFeedbackMetadataProvider.StoredProcedure.GetProductReviewAttributeCategoryRelations.CommandName, 3, reader);

			connection = new MockDatabaseConnection(command.Object);

			connectionFactory = new MockDatabaseConnectionFactory(TestConstants.TenantId.JTLeigh, ProductFeedbackMetadataProvider.DatabaseKeyReadOperations, connection.Object);

			provider = new ProductFeedbackMetadataProvider()
			{
				DatabaseConnectionFactory = connectionFactory.Object,
			};

            relations = provider.GetProductReviewAttributeCategoryRelations(TestConstants.TenantId.JTLeigh, "BaseCatalog", "ABC");

			command.VerifyAll();
			connection.VerifyAll();

			Assert.IsNotNull(relations);

			Assert.AreEqual(2, relations.Associations.Count);
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Pros, relations.Associations[0].AssociatedItemId);
			Assert.AreEqual(new DateTime(2008, 06, 01), relations.Associations[0].StartDate);
			Assert.AreEqual(new DateTime(2008, 07, 01), relations.Associations[0].FinishDate);
			Assert.AreEqual(10, relations.Associations[0].DisplayOrder);
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Cons, relations.Associations[1].AssociatedItemId);
			Assert.AreEqual(new DateTime(2008, 08, 01), relations.Associations[1].StartDate);
			Assert.IsNull(relations.Associations[1].FinishDate);
			Assert.AreEqual(20, relations.Associations[1].DisplayOrder);

			Assert.AreEqual(2, relations.Disassociations.Count);

			Assert.AreEqual(2, relations.Associations.Count);
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Pros, relations.Disassociations[0].DisassociatedItemId);
			Assert.AreEqual(new DateTime(2008, 06, 15), relations.Disassociations[0].StartDate);
			Assert.AreEqual(new DateTime(2008, 06, 25), relations.Disassociations[0].FinishDate);
			Assert.AreEqual(Constants.ProductReviewAttribute.AttributeId.Cons, relations.Disassociations[1].DisassociatedItemId);
			Assert.AreEqual(new DateTime(2008, 08, 15), relations.Disassociations[1].StartDate);
			Assert.IsNull(relations.Disassociations[1].FinishDate);
		}

		#endregion // GetProductReviewAttributeCategoryRelations

		#endregion // Methods

	}

}
